package com.lkd.mapper;

import com.lkd.entity.Task;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface StatisticsMapper {

    //订单统计
    @Select("select count(*) from tb_order where create_time between #{start} and #{end}")
    Integer orderCount(LocalDateTime start, LocalDateTime end);

    //销售额统计
    @Select("select ifnull(sum(amount),0) from tb_order where create_time between #{start} and #{end}")
    Double orderAmount(LocalDateTime start, LocalDateTime end);

    //点位数量
    @Select("select count(*) from tb_node")
    Integer nodeCount();

    //合作商数量
    @Select("select count(*) from tb_partner")
    Integer partnerCount();

    @Select("select * from tb_task where create_time between #{start} and #{end}")
    List<Task> findTask(LocalDateTime start, LocalDateTime end);
}
